package com.huangfu.learning.javabase.java.restructure.polymorphicreplaceswitch.polymorphic;

/**
 * Created with IntelliJ IDEA.
 * Author: huangfu.daohui
 * Date: 2018/11/13
 * Time: 10:58
 * Version: 1.0
 * Description:使用测试
 **/
public class TestMain {

    public static void main(String[] args) {
        // 创建对象
        Manager manager = new Manager();
        Engineer engineer = new Engineer();
        Salesman salesman = new Salesman();

        EmployeeNew employeeNew = new EmployeeNew();
        //设置员工类型
        employeeNew.setEmployeeType(manager);
        // 打印员工信息
        System.out.println("manager薪资：" + employeeNew.payAmount());
        //设置员工类型
        employeeNew.setEmployeeType(engineer);
        // 打印员工信息
        System.out.println("engineer薪资：" + employeeNew.payAmount());
        //设置员工类型
        employeeNew.setEmployeeType(salesman);
        // 打印员工信息
        System.out.println("salesman薪资：" + employeeNew.payAmount());
    }
}
